<html>
<head>
<script type="text/javascript">
	var aJaxURL			= "server-side/document.action.php";					//server side folder url
	var tName			= "table";														//table name
	var fName			= "add-edit-form-";												//form name
    var tbName			= "tabs";
    var tab             =  0;
    var e				= true;										//tabs name

	$(document).ready(function () {
		GetTabs(tbName);
		LoadTable(tab);
	});

    $(document).on("tabsactivate", "#tabs", function() {
    	tab = GetSelectedTab(tbName);
    	LoadTable(tab);
    });
	 function LoadTable(tab) {
		// var total = [3]
		 t_name=tName+"-"+tab;
		 var r=6;
		 if(tab==1) r=4;
		 GetDataTable2(t_name, aJaxURL, "get_list", r , "tab="+tab+'&inv=inv', 0, "", 1, "desc", '3');
		 SetEvents('','','',t_name,fName+tab,aJaxURL,"tab="+tab+'&inv=inv');

     }

		function LoadDialog(fName){
			//alert(tab)
			//LoadTable(tab);
			var buttons = {
			       /*  "print-letterB": {
			            text: "ბეჭდვა",
			            id: "print-letterB",
			            click: function () {

			            	var link = GetRootDIR();
		        	    	link = link + "server-side/print/print_letterB.php?id="+$("#a_letter_id").val();

		        	    	var newWin = window.open(link, "JSSite", "width=800,height=800,resizable=yes,scrollbars=yes,status=yes");
		        	    	newWin.focus();
		        	    	newWin.onload = function() {
		        	    		newWin.print();
		        	    	}
			            }
			        },
			        "continue-rs": {
			            text: "rs.ge - ზე დასრულება",
			            id: "continue-rs",
			            click: function () {
			            }
			        },
			        "add-rs": {
			            text: "rs.ge - ზე გააქტიურება",
			            id: "add-rs",
			            click: function () {
			            }
			        }, */
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");

			            }
			        }
			};
			var overhead_id	= $("#overhead_id").val();
			GetDialog(fName, "auto", "auto", buttons);
			if(fName=='add-edit-form-1'){
				//alert($('#inv_id').val());
						GetDataTable2('table-3', aJaxURL, "get_list", 5 , "tab=3&id="+$('#inv_id').val(), 0, "", 1, "asc", "3");
					 SetEvents('','','','table-3',"add-edit-form-0",aJaxURL);
			}
			if( empty(overhead_id) ){
				$("#continue-rs").button("disable");
			}

		}

</script>
</head>

<body>
	<div id="tabs" style="width: 820px; margin: 0 auto; min-height: 768px;">
		<ul>
			<li><a href="#tab-0">ხელმოწერილი აქტები</a></li>
			<li><a href="#tab-1">ანგარიშ ფაქტურები</a></li>
		</ul>

	<div id="tab-0">
	    <div id="dt_example" class="ex_highlight_row">
	        <div id="container">
	            <div id="dynamic">
	                <h2 align="center">გამოსაწერი </h2>
		        	<div id="button_area">
		        	</div>
	                <table class="display" id="table-0">
	                    <thead>
	                        <tr id="datatable_header">
	                            <th>ID</th>
	                            <th style="width: 120px" >თარიღი </th>
	                            <th style="width: 120px">ბარათის ნომერი </th>
	                            <th style="width: 100px">თანხა</th>
	                            <th style="width: 110%">ფილიალი</th>
	                            <th style="width: 110px">შენიშვნა</th>

	                        </tr>
	                    </thead>
	                    <thead>
	                        <tr class="search_header">
	                            <th class="colum_hidden">
	                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_aleter" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                            	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                            	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                        </tr>
	                    </thead>
						<tfoot>
                        <tr>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th><p align="right">ჯამი:<br/>სულ ჯამი:</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                        </tr>
                    </tfoot>
	                </table>
	            </div>
	            <div class="spacer">
	            </div>
	        </div>
	    </div>
    </div>
    <div id="tab-1">
    	    <div id="dt_example" class="ex_highlight_row">
	        <div id="container">
	            <div id="dynamic">
	                <h2 align="center">გამოწერილი</h2>
		        	<div id="button_area">
		        	</div>
	                <table class="display" id="table-1">
	                    <thead>
	                        <tr id="datatable_header">
	                            <th>ID</th>
	                            <th style="width: 35%">თარიღი</th>
	                            <th style="width: 20%">ა/ნ ნომერი</th>
								<th style="width: 20%">თანხა</th>
	                            <th style="width: 35%">სტატუსი</th>

	                        </tr>
	                    </thead>
	                    <thead>
	                        <tr class="search_header">
	                            <th class="colum_hidden">
	                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_aleter" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                            <th>
	                                <input type="text" name="search_client" value="ფილტრი" class="search_init" />
	                            </th>
	                        </tr>
	                    </thead>
						<tfoot>
                        <tr>
                            <th>&nbsp;</th>
                            <th>&nbsp;</th>
                            <th><p align="right">ჯამი:<br/>სულ ჯამი:</th>
                            <th>&nbsp;</th>
                             <th>&nbsp;</th>
                        </tr>
                    </tfoot>
	                </table>
	            </div>
	            <div class="spacer">
	            </div>
	        </div>
	    </div>
    </div>
    </div>
	<div>
		<input type="hidden" id="chechedStatus" value="true"/>
    </div>
	<div id="add-edit-form-0" class="form-dialog" title="ბლანკი">
    	<!-- aJax -->
	</div>
	<div id="add-edit-form-1" class="form-dialog" title="ბლანკი">
    	<!-- aJax -->
	</div>
</body>
</html>